package com.istock.servicesample.controller;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.istock.base.common.api.model.ApiBaseResponse;
import com.istock.base.common.api.model.RetStatusEnum;

@RequestMapping("test")
@RestController
public class ShowHeaderController {

	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@RequestMapping(value="showHeader",method=RequestMethod.POST)
	public ApiBaseResponse<String> showHeader(HttpServletRequest request){
		Enumeration<String> headerNameEnum = request.getHeaderNames();
		while(headerNameEnum.hasMoreElements()) {
			String headerName = headerNameEnum.nextElement() ;
			logger.info("find header {}=[{}]" , headerName, request.getHeader(headerName));
		}
		return new ApiBaseResponse<String>(RetStatusEnum.SUCCESS , "OK"," showHeader success" , "okkkkk");
	}
}
